﻿<Window
        xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation"
        xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml"    
        xmlns:core="clr-namespace:InstantSpine.Core;assembly=InstantSpine.Core"
        xmlns:gui="clr-namespace:InstantSpine.GUI"
        xmlns:p="clr-namespace:InstantSpine.GUI.Properties"
        xmlns:xctk="http://schemas.xceed.com/wpf/xaml/toolkit"
        xmlns:i="clr-namespace:System.Windows.Interactivity;assembly=System.Windows.Interactivity"
        xmlns:mvvml="http://www.galasoft.ch/mvvmlight"
        xmlns:d="http://schemas.microsoft.com/expression/blend/2008" xmlns:mc="http://schemas.openxmlformats.org/markup-compatibility/2006" mc:Ignorable="d" x:Class="InstantSpine.GUI.MainWindow"
        Title="{Binding WindowTitle, Source={StaticResource mwvm}}"
        TextOptions.TextFormattingMode="{Binding textRenderMode, Source={x:Static p:Settings.Default}}"
        Width="820" Height="680"
        MinWidth="820" MinHeight="400" Background="White">
    <i:Interaction.Triggers>
        <i:EventTrigger EventName="Closing">
            <i:InvokeCommandAction Command="{Binding HandleClosingCommand, Source={StaticResource mwvm}}" />
            <!--<mvvml:EventToCommand Command="{Binding HandleClosingCommand, Source={StaticResource mwvm}}" PassEventArgsToCommand="True"/>-->
        </i:EventTrigger>
    </i:Interaction.Triggers>
    <xctk:BusyIndicator IsBusy="{Binding IsBusyGeneratingModel, Source={StaticResource mwvm}}" BusyContent="{Binding ModelGenerationBusyMessage, Source={StaticResource mwvm}}">
    <Grid>        
        <Grid.RowDefinitions>
            <RowDefinition Height="auto"/>
            <RowDefinition Height="*"/>
        </Grid.RowDefinitions>
        <Grid.LayoutTransform>
            <ScaleTransform 
				ScaleX="{Binding uiScaleFactor, Source={x:Static p:Settings.Default}}"
				ScaleY="{Binding uiScaleFactor, Source={x:Static p:Settings.Default}}"/>
        </Grid.LayoutTransform>
        <Menu Grid.Row="0">
            <MenuItem Header="{x:Static p:Resources.File}">
                <MenuItem Header="{Loc Open}" Command="{Binding LoadModelParameterizationCommand, Source={StaticResource mwvm}}"/>
                <MenuItem Header="{Loc ClearAll}" Command="{Binding ClearAllCommand, Source={StaticResource mwvm}}"/>
                <Separator/>
                <MenuItem Header="{Loc Save}" Command="{Binding SaveModelParameterizationCommand, Source={StaticResource mwvm}}"/>
                <MenuItem Header="{Loc SaveAs}" Command="{Binding DisplaySaveModelParameterizationDialogCommand, Source={StaticResource mwvm}}"/>
                <Separator/>
                <MenuItem Header="{Loc Exit}" Command="{Binding ExitCommand, Source={StaticResource mwvm}}"/>
            </MenuItem>
            <MenuItem Header="{Loc Options}" Command="{Binding DisplayOptionsDialogCommand, Source={StaticResource mwvm}}"/>
            <MenuItem Header="{Loc About}"/>
        </Menu>
        <ScrollViewer Grid.Row="1" IsEnabled="True" HorizontalScrollBarVisibility="Disabled" VerticalScrollBarVisibility="Auto">
            <StackPanel Margin="10,12" DataContext="{StaticResource ResourceKey=mwvm}" >
                <!-- Anatomy data editor -->
                <Expander x:Name="AnatomyPanel" IsExpanded="{Binding anatomyIsExpanded, Mode=TwoWay, Source={x:Static p:Settings.Default}}">
                    <Expander.Header>
                        <Grid Width="{Binding ActualWidth, RelativeSource={RelativeSource AncestorType={x:Type Expander}, Mode=FindAncestor}}">
                            <Grid.ColumnDefinitions>
                                <ColumnDefinition Width="Auto" />
                                <ColumnDefinition Width="*" />
                            </Grid.ColumnDefinitions>
                            <TextBlock TextOptions.TextFormattingMode="Ideal" Grid.Column="0" Text="{x:Static p:Resources.Anatomy}" FontSize="20" FontWeight="UltraLight" VerticalAlignment="Center" Margin="0,0,8,0" Padding="0,0,0,4"/>
                            <Separator Grid.Column="1" />
                        </Grid>
                    </Expander.Header>
                    <xctk:BusyIndicator IsBusy="{Binding IsBusyComputingAnatomy}" BusyContent="{Binding AnatomyBusyMessage}">
                        <StackPanel Margin="0, 8, 0, 10">
                            <GroupBox Header="{x:Static p:Resources.ParameterDependencies}" HeaderTemplate="{StaticResource gbHdr}">
                                <StackPanel Margin="8">
                                    <Grid>
                                        <!-- DataContext = scriptFileSelector; Bind to selectedFile, Command = OpenFileCommand -->
                                        <Grid.ColumnDefinitions>
                                            <ColumnDefinition Width="*"/>
                                            <ColumnDefinition Width="auto"/>
                                        </Grid.ColumnDefinitions>
                                        <xctk:WatermarkTextBox Grid.Row="0" Grid.Column="0" Margin="0,0,8,0" VerticalAlignment="Center" Text="{Binding RegressionScriptFileName, UpdateSourceTrigger=PropertyChanged}" Watermark="Script file name" WatermarkTemplate="{StaticResource wmTmplt}"/>
                                        <Button Padding="8,2" Grid.Row="0" Grid.Column="1" Content="{x:Static p:Resources.Browse}" VerticalAlignment="Center" Command="{Binding BrowseForScriptCommand, Mode=OneWay}"/>
                                    </Grid>
                                    <CheckBox Grid.Row="1" Grid.Column="0" Margin="0,6,0,0" Content="{x:Static p:Resources.UseRegressionEquations}" IsChecked="{Binding UseRegression, Mode=TwoWay}" IsEnabled="{Binding CanEnableRegression}" VerticalAlignment="Center"/>
                                </StackPanel>
                            </GroupBox>
                            <GroupBox Header="DATA" Margin="0, 8, 0, 0" HeaderTemplate="{StaticResource gbHdr}">
                                <StackPanel Margin="8">
                                    <DataGrid x:Name="anatomyDataGrid"
										DataContext="{Binding SpineModel.Anatomy}"
										ItemsSource="{Binding VertebraeAndDiscs}" 
										AutoGenerateColumns="False" 
										GridLinesVisibility="Horizontal" 
										HorizontalGridLinesBrush="LightGray" 
										VerticalGridLinesBrush="LightGray" 
										AlternatingRowBackground="#F0F0F0" 
										HeadersVisibility="All"
										Margin="0" CanUserAddRows="False" CanUserDeleteRows="False"
										ColumnHeaderStyle="{StaticResource rightAlignedColHdr}"
										CellStyle="{StaticResource matPropCell}">
                                        <DataGrid.RowHeaderStyle>
                                            <Style TargetType="{x:Type DataGridRowHeader}">
                                                <Setter Property="Content" Value="{Binding VertebralBodyName}"/>
                                            </Style>
                                        </DataGrid.RowHeaderStyle>
                                        <DataGrid.Columns>
                                            <!--<DataGridTextColumn Binding="{Binding Path=VertebralBodyName}" IsReadOnly="True" CanUserSort="False" Header="ID"/>-->
                                            <DataGridTextColumn Width="50" Binding="{Binding VertebralBodyHeightPosterior, StringFormat=\{0:F1\}}" CanUserSort="False" Header="VBHp"/>
                                            <DataGridTextColumn Width="50" Binding="{Binding EndplateWidthSuperior, StringFormat=\{0:F1\}}" CanUserSort="False" Header="EPWs" />
                                            <DataGridTextColumn Width="50" Binding="{Binding EndplateWidthInferior, StringFormat=\{0:F1\}}" CanUserSort="False" Header="EPWi" />
                                            <DataGridTextColumn Width="50" Binding="{Binding EndplateDepthSuperior, StringFormat=\{0:F1\}}" CanUserSort="False" Header="EPDs" />
                                            <DataGridTextColumn Width="50" Binding="{Binding EndplateDepthInferior, StringFormat=\{0:F1\}}" CanUserSort="False" Header="EPDs" />
                                            <DataGridTextColumn Width="50" Binding="{Binding DiscHeight, StringFormat=\{0:F1\}}" CanUserSort="False" Header="DH" />
                                            <DataGridTextColumn Width="50" Binding="{Binding PedicleLength, StringFormat=\{0:F1\}}" CanUserSort="False" Header="PL" />
                                            <DataGridTextColumn Width="50" Binding="{Binding PedicleSagitalInclinationRight, StringFormat=\{0:F1\}}" CanUserSort="False" Header="PISr" />
                                            <DataGridTextColumn Width="50" Binding="{Binding PedicleSagitalInclinationLeft, StringFormat=\{0:F1\}}" CanUserSort="False" Header="PISl" />
                                            <DataGridTextColumn Width="50" Binding="{Binding PedicleTransverseInclinationRight, StringFormat=\{0:F1\}}" CanUserSort="False" Header="PITr" />
                                            <DataGridTextColumn Width="50" Binding="{Binding PedicleTransverseInclinationLeft, StringFormat=\{0:F1\}}" CanUserSort="False" Header="PITl" />                                                
                                            <DataGridTextColumn Width="50" Binding="{Binding FacetTiltLeftX, StringFormat=\{0:F1\}}" CanUserSort="False" Header="CAXl" />
                                            <DataGridTextColumn Width="50" Binding="{Binding FacetTiltLeftY, StringFormat=\{0:F1\}}" CanUserSort="False" Header="CAYl" />
                                            <DataGridTextColumn Width="50" Binding="{Binding FacetTiltRightX, StringFormat=\{0:F1\}}" CanUserSort="False" Header="CAXr" />
                                            <DataGridTextColumn Width="50" Binding="{Binding FacetTiltRightY, StringFormat=\{0:F1\}}" CanUserSort="False" Header="CAYr" />
                                            <DataGridTextColumn Width="50" Binding="{Binding FacetWidthLeft, StringFormat=\{0:F1\}}" CanUserSort="False" Header="FWl" />
                                            <DataGridTextColumn Width="50" Binding="{Binding FacetWidthRight, StringFormat=\{0:F1\}}" CanUserSort="False" Header="FWr" />
                                            <DataGridTextColumn Width="50" Binding="{Binding FacetHeightLeft, StringFormat=\{0:F1\}}" CanUserSort="False" Header="FHl" />
                                            <DataGridTextColumn Width="50" Binding="{Binding FacetHeightRight, StringFormat=\{0:F1\}}" CanUserSort="False" Header="FHr" />
                                        </DataGrid.Columns>
                                    </DataGrid>
                                    <StackPanel Orientation="Horizontal">
                                        <Button Content="Export..." Margin="0,8,8,0" Padding="8,2" Command="{Binding ExportAnatomyDataCommand, Source={StaticResource mwvm}}"/>
                                        <Button Content="Import..." Margin="0,8,8,0" Padding="8,2" Command="{Binding ImportAnatomyDataCommand, Source={StaticResource mwvm}}"/>
                                    </StackPanel>
                                </StackPanel>
                            </GroupBox>
                        </StackPanel>
                    </xctk:BusyIndicator>
                </Expander>
                <!-- Material props editor -->
                <Expander x:Name="MaterialPropertiesPanel" IsExpanded="{Binding materialIsExpanded, Mode=TwoWay, Source={x:Static p:Settings.Default}}" 
					Margin="0,8,0,0"                     
                    DataContext="{Binding SpineModel.Materials}">                   
                    <Expander.Header>
                        <Grid Width="{Binding ActualWidth, RelativeSource={RelativeSource AncestorType={x:Type Expander}, Mode=FindAncestor}}">
                            <Grid.ColumnDefinitions>
                                <ColumnDefinition Width="Auto" />
                                <ColumnDefinition Width="*" />
                            </Grid.ColumnDefinitions>
                            <TextBlock TextOptions.TextFormattingMode="Ideal" Grid.Column="0" Text="{x:Static p:Resources.MaterialProperties}" FontSize="20" FontWeight="UltraLight" VerticalAlignment="Center" Margin="0,0,8,0" Padding="0,0,0,4"/>
                            <Separator Grid.Column="1" />
                        </Grid>
                    </Expander.Header>
                    <Grid Margin="0, 8, 0, 10">
                        <Grid.ColumnDefinitions>
                            <ColumnDefinition Width="auto"/>
                            <ColumnDefinition Width="*"/>
                        </Grid.ColumnDefinitions>
                        <Grid.RowDefinitions>
                            <RowDefinition/>
                            <RowDefinition/>
                        </Grid.RowDefinitions>
                        <!-- Using a ContentControl with type-dependent templates bound to a ListView -->
                        <ListView 
							BorderBrush="#F0F0F0" 
							Background="#FBFBFB" 
							Grid.Column="0" 
							ItemsSource="{Binding AllMaterials}" 
							SelectedIndex="0" 
							x:Name="materials">
                            <!-- display materials' names -->
                            <ListView.ItemTemplate>
                                <DataTemplate>
                                    <TextBlock Text="{Binding Name}" Padding="4,2,8,2"/>
                                </DataTemplate>
                            </ListView.ItemTemplate>
                        </ListView>
                        <!-- display an appropriate editor for the chosen material -->
                        <ContentControl 
							Grid.Column="1" 
							DataContext="{Binding SelectedItem, ElementName=materials}" 
							Content="{Binding}" 
							Resources="{StaticResource materialEditorTemplates}"/>
                    </Grid>
                </Expander>
                <!-- Meshing options -->
                <Expander Name="MeshGenerationPanel" IsExpanded="{Binding meshingIsExpanded, Mode=TwoWay, Source={x:Static p:Settings.Default}}" Margin="0,8,0,0"
					DataContext="{Binding SpineModel.Options}" >
                    <Expander.Header>
                        <Grid Width="{Binding ActualWidth, RelativeSource={RelativeSource AncestorType={x:Type Expander}, Mode=FindAncestor}}">
                            <Grid.ColumnDefinitions>
                                <ColumnDefinition Width="Auto" />
                                <ColumnDefinition Width="*" />
                            </Grid.ColumnDefinitions>
                            <TextBlock TextOptions.TextFormattingMode="Ideal" Grid.Column="0" Text="FE mesh generation" FontSize="20" FontWeight="UltraLight" VerticalAlignment="Center" Margin="0,0,8,0" Padding="0,0,0,4"/>
                            <Separator Grid.Column="1" />
                        </Grid>
                    </Expander.Header>
                    <Grid Margin="8,8,0,0">
                        <Grid.RowDefinitions>
                            <RowDefinition/>
                            <RowDefinition/>
                            <RowDefinition/>
                            <RowDefinition/>
                            <RowDefinition/>
                            <RowDefinition Height="*"/>
                        </Grid.RowDefinitions>
                        <Grid.ColumnDefinitions>
                            <ColumnDefinition MinWidth="300" Width="*"/>
                            <ColumnDefinition Width="*"/>
                        </Grid.ColumnDefinitions>
                        <TextBlock Grid.Row="0" Grid.Column="0" Text="MESH RESOLUTION OPTIONS" VerticalAlignment="Center" Style="{StaticResource ResourceKey=smallHeader}"/>
                        <TextBlock Grid.Row="0" Grid.Column="1" Text="PREVIEW" VerticalAlignment="Center" Style="{StaticResource ResourceKey=smallHeader}"/>
                        <Grid Margin="0,0,64,16"
							Grid.Row="1"
							Grid.Column="0">
                            <Grid.RowDefinitions>
                                <RowDefinition Height="auto"/>
                                <RowDefinition Height="auto"/>
                                <RowDefinition Height="auto"/>
                                <RowDefinition Height="auto"/>
                                <RowDefinition Height="auto"/>
                                <RowDefinition Height="auto"/>
                                <RowDefinition Height="auto"/>
                                <RowDefinition Height="*"/>
                            </Grid.RowDefinitions>
                            <Grid.ColumnDefinitions>
                                <ColumnDefinition Width="auto"/>
                                <ColumnDefinition Width="*"/>
                            </Grid.ColumnDefinitions>
                            <TextBlock Margin="0,0,16,4" Grid.Row="0" Grid.Column="0" VerticalAlignment="Center" Text="Radial resolution (above nucleus)"/>
                            <TextBlock Margin="0,0,16,0" Grid.Row="1" Grid.Column="0" VerticalAlignment="Center" Text="Radial resolution (above annulus)"/>
                            <TextBlock Margin="0,0,16,0" Grid.Row="2" Grid.Column="0" VerticalAlignment="Center" Text="Circumferential resolution"/>
                            <TextBlock Margin="0,0,16,0" Grid.Row="3" Grid.Column="0" VerticalAlignment="Center" Text="Axial resolution (vertebral body)"/>
                            <TextBlock Margin="0,0,16,0" Grid.Row="4" Grid.Column="0" VerticalAlignment="Center" Text="Axial resolution (intervertebral disc)"/>
                            <TextBlock Margin="0,16,0,4" Grid.Row="5" Grid.Column="0" VerticalAlignment="Center" Text="Cortical shell resolution"/>
                            <TextBlock Margin="0,0,16,0" Grid.Row="6" Grid.Column="0" VerticalAlignment="Center" Text="Endplates axial resolution"/>

                            <xctk:IntegerUpDown Margin="0,0,0,4" Grid.Row="0" Grid.Column="1" VerticalAlignment="Center" Value="{Binding InnerRadialSubdivisions.ParameterValue, UpdateSourceTrigger=PropertyChanged}" Minimum="2" Maximum="100"/>
                            <xctk:IntegerUpDown Margin="0,4" Grid.Row="1" Grid.Column="1" VerticalAlignment="Center" Value="{Binding OuterRadialSubdivisions.ParameterValue, UpdateSourceTrigger=PropertyChanged}" Minimum="2" Maximum="100"/>
                            <xctk:IntegerUpDown Margin="0,4" Grid.Row="2" Grid.Column="1" VerticalAlignment="Center" Value="{Binding CircumferentialSubdivisions.ParameterValue, UpdateSourceTrigger=PropertyChanged}" Minimum="2" Maximum="100"/>
                            <xctk:IntegerUpDown Margin="0,4" Grid.Row="3" Grid.Column="1" VerticalAlignment="Center" Value="{Binding AxialSubdivisionsVB.ParameterValue, UpdateSourceTrigger=PropertyChanged}" Minimum="2" Maximum="100"/>
                            <xctk:IntegerUpDown Margin="0,4" Grid.Row="4" Grid.Column="1" VerticalAlignment="Center" Value="{Binding AxialSubdivisionsDisc.ParameterValue, UpdateSourceTrigger=PropertyChanged}" Minimum="2" Maximum="100"/>
                            <xctk:IntegerUpDown Margin="0,16,0,4" Grid.Row="5" Grid.Column="1" VerticalAlignment="Center" Value="{Binding CorticalShellRadialSubdivisions.ParameterValue, UpdateSourceTrigger=PropertyChanged}" Minimum="2" Maximum="100"/>
                            <xctk:IntegerUpDown Margin="0,4" Grid.Row="6" Grid.Column="1" VerticalAlignment="Center" Value="{Binding EndplateAxialSubdivisions.ParameterValue, UpdateSourceTrigger=PropertyChanged}" Minimum="2" Maximum="100"/>
                        </Grid>
                        <Grid Grid.Row="1" Grid.Column="1">
                            <Grid.ColumnDefinitions>
                                <ColumnDefinition Width="auto"/>
                                <ColumnDefinition Width="auto"/>
                            </Grid.ColumnDefinitions>
                            <gui:MeshResolutionViz
								Grid.Column="0"
								VerticalAlignment="Top"
								HorizontalAlignment="Left"                            
								Width="180" 
								Height="140"
								StrokeColor="DarkGray"
								OutlineStrokeColor="Gray"
								StrokeThickness="1.0"
								OutlineStrokeThickness="2.0"
								InnerRadialResolution="{Binding InnerRadialSubdivisions.ParameterValue}"
								OuterRadialResolution="{Binding OuterRadialSubdivisions.ParameterValue}"
								CircumferentialResolution="{Binding CircumferentialSubdivisions.ParameterValue}"/>
                            <gui:LateralMeshViz
								Grid.Column="1"
								VerticalAlignment="Top"
								HorizontalAlignment="Left"                            
								StrokeThickness="1.0"
								OutlineStrokeThickness="2.0"
								StrokeColor="DarkGray"
								OutlineStrokeColor="Gray"
								AxialResolutionVB="{Binding AxialSubdivisionsVB.ParameterValue}"
								AxialResolutionDisc="{Binding AxialSubdivisionsDisc.ParameterValue}"/>
                        </Grid>
                        <TextBlock Grid.Row="2" Grid.Column="0" Text="SEGMENT SELECTION" VerticalAlignment="Center" Style="{StaticResource ResourceKey=smallHeader}"/>
                        <Grid Grid.Row="3" Grid.Column="0" Margin="0,0,64,0">
                            <Grid.RowDefinitions>
                                <RowDefinition/>
                                <RowDefinition/>
                                <RowDefinition Height="*"/>
                            </Grid.RowDefinitions>
                            <Grid.ColumnDefinitions>
                                <ColumnDefinition Width="auto"/>
                                <ColumnDefinition Width="30"/>
                                <ColumnDefinition Width="*"/>
                            </Grid.ColumnDefinitions>
                            <TextBlock Text="From" Grid.Row="0" Grid.Column="0" HorizontalAlignment="Right"/>
                            <TextBlock Text="To" Grid.Row="1" Grid.Column="0" HorizontalAlignment="Right"/>
                            <TextBlock Text="{Binding FirstVB.ParameterValue, Converter={StaticResource vbIdConverter}}" Grid.Row="0" Grid.Column="1" HorizontalAlignment="Center"/>
                            <TextBlock Text="{Binding LastVB.ParameterValue, Converter={StaticResource vbIdConverter}}" Grid.Row="1" Grid.Column="1" HorizontalAlignment="Center"/>
                            <Slider Grid.Row="0" Grid.Column="2" Margin="0,0,0,0" 
                                IsSnapToTickEnabled="True"
                                Minimum="1"
                                Maximum="18"
                                TickFrequency="1"
                                Ticks="1,2,3,4,5,6,7,8,9,10,11,12,13,14,15,16,17,18"
                                TickPlacement="BottomRight"
                                Value="{Binding FirstVB.ParameterValue}"/>
                            <Slider Grid.Row="1" Grid.Column="2" Margin="0,-4,0,0"
                                IsSnapToTickEnabled="True"
                                Minimum="1"
                                Maximum="18"
                                TickFrequency="1"
                                Ticks="1,2,3,4,5,6,7,8,9,10,11,12,13,14,15,16,17,18"
                                TickPlacement="TopLeft"
                                Value="{Binding LastVB.ParameterValue}"/>
                        </Grid>                        
                        <TextBlock Grid.Row="2" Grid.Column="1" Text="TARGET FE SOLVER" VerticalAlignment="Center" Style="{StaticResource ResourceKey=smallHeader}"/>
                        <Grid Grid.Row="3" Grid.Column="1" Margin="0,0,0,0">
                            <Grid.RowDefinitions>
                                <RowDefinition/>
                                <RowDefinition/>
                                <RowDefinition/>
                            </Grid.RowDefinitions>
                            <Grid.Resources>
                                <gui:EnumToBooleanConverter x:Key="enumToBoolean"/>
                            </Grid.Resources>
                            <!-- TODO: only enable choices with known exe location -->
                            <RadioButton Grid.Row="0" GroupName="FeSolverChoice" IsChecked="{Binding Path=Target, Converter={StaticResource enumToBoolean}, ConverterParameter={x:Static core:TargetFESolver.Abaqus}}" Content="Abaqus/Standard" Margin="0,0,0,4"/>
                            <RadioButton Grid.Row="1" GroupName="FeSolverChoice" IsChecked="{Binding Path=Target, Converter={StaticResource enumToBoolean}, ConverterParameter={x:Static core:TargetFESolver.FEBio}}" Content="FEBio" Margin="0,0,0,4"/>
                            <RadioButton Grid.Row="2" GroupName="FeSolverChoice" IsChecked="{Binding Path=Target, Converter={StaticResource enumToBoolean}, ConverterParameter={x:Static core:TargetFESolver.Ansys}}"  Content="ANSYS" Margin="0,0,0,4"/>
                        </Grid>
                        <Grid Grid.Row="4" Grid.Column="0" Grid.ColumnSpan="2">
                            <Grid.ColumnDefinitions>
                                <ColumnDefinition/>
                                <ColumnDefinition Width="auto"/>
                            </Grid.ColumnDefinitions>
                            <Separator Grid.Column="0" Margin="0,8,8,0"/>
                            <Button Grid.Column="1" Command="{Binding GenerateSpineModelCommand, Source={StaticResource mwvm}}" HorizontalAlignment="Right" Content="Generate spine model" Margin="0,8,0,0" Padding="6, 4"/>
                        </Grid>
                    </Grid>
                </Expander>
                <!--<Grid>
                    <Grid.ColumnDefinitions>
                        <ColumnDefinition/>
                        <ColumnDefinition Width="auto"/>
                    </Grid.ColumnDefinitions>
                    <Separator Grid.Column="0" Margin="0,8,8,0"/>
                    <Button Grid.Column="1" HorizontalAlignment="Right" Content="Generate spine model" Margin="0,8,0,0" Padding="6, 4"/>
                </Grid>-->
            </StackPanel>
        </ScrollViewer>        
    </Grid>
    </xctk:BusyIndicator>
</Window>